package com.ihome.android;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.View;

import com.ihome.android.util.log.LogUtil;

public abstract class EAFragment extends Fragment {

	protected View	mFragView;

	/**
	 * 每一个继承EAFragment 的类都必须重写该方法<br>
	 * 给 {@link #mFragView} 赋值，以便注射初始化View
	 * 
	 */
	protected abstract void setFragView();

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		LogUtil.d("EAFragment", "--> onViewCreated");
		super.onViewCreated(view, savedInstanceState);
		setFragView();
		initFragment();
	}

	public EAApp getEAApplication() {
		return (EAApp) getActivity().getApplication();
	}

	private void initFragment() {
		LogUtil.d("EAFragment", "-->initFragment()");
		getEAApplication().getInjector().inJectAll(this, mFragView);
	}

}
